#***********************************************************************************
#* Code license:  GNU General Public License v3                                    *
#* Main page:     https://code.google.com/p/library-cross-platform/                *
#* Issue tracker: https://code.google.com/p/library-cross-platform/issues/list     *
#***********************************************************************************

platform ?= linux

include ../../cpp/include.mk
INCLUDES = -I$(HOME_DIR)

include $(HOME_DIR)/target.mk
include $(PARSER_DIR)/parser.mk

TEST_DIR = $(CURRENT_DIR)

TEST_INCLUDE = -I$(HOME_DIR) -I$(PARSER_DIR) -I$(TEST_DIR)


TEST_C_FILES   =
TEST_CC_FILES  =
TEST_CPP_FILES =                            \
         $(TEST_DIR)/main_test.cpp          \
         $(TEST_DIR)/rexp_test.cpp          \
         $(TEST_DIR)/valbyref_test.cpp      \
         $(TEST_DIR)/val2string_test.cpp    \
         $(TEST_DIR)/factory_test.cpp       \
         $(TEST_DIR)/math_test.cpp          \

TARGET = test_$(target).exe


OBJECTS_TESTS := $(TEST_C_FILES:.c=_$(target).o) $(TEST_CC_FILES:.cc=_$(target).o) $(TEST_CPP_FILES:.cpp=_$(target).o)

test_build: $(OBJECTS_PARSER) $(OBJECTS_TESTS)
	$(CC) $(DEBUG) -o $(TARGET) $(OBJECTS_TESTS) $(OBJECTS_PARSER) $(LIBS)

%_$(target).o: %.cpp
	$(CC) $(DEBUG) $(CFLAGS) $(DEFINE) $(TEST_INCLUDE) -o $@ -c $<

%_$(target).o: %.c
	$(CC) $(DEBUG) $(CFLAGS) $(DEFINE) $(TEST_INCLUDE) -o $@ $<

%_$(target).o: %.cc
	$(CC) $(DEBUG) $(CFLAGS) $(DEFINE) $(TEST_INCLUDE) -o $@ $<


.PHONY : clean

clean: parser_clean
	\rm -rf $(OBJECTS_TESTS)
